﻿Namespace Ventas
    Public Class frmCaja
        Public Property ComprobanteDetalle As Farmacia.Entity.Ventas.ComprobanteDetalleCol
        Public Property ComprobanteCabecera As Farmacia.Entity.Ventas.Comprobante


        Private Property ClienteID As Integer = -1

        Private Sub frmCaja_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        End Sub

        Private Sub frmCaja_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
            Dim vbol As Boolean = True
            If ComprobanteDetalle Is Nothing Then
                vbol = False
            Else
                If ComprobanteDetalle.Count = 0 Then
                    vbol = False
                End If
            End If
            ValidarComportamiento(vbol)
        End Sub
        Public Sub ValidarComportamiento(ByVal vbol As Boolean)
            If vbol Then
                Me.dgv_caja.DataSource = ComprobanteDetalle
                Me.txt_orden.ReadOnly = True
                Me.txt_pago.Focus()
            Else
                Me.txt_orden.Focus()
            End If

        End Sub

        Private Sub btn_Boleta_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Boleta.Click
            Grabar()

        End Sub
        Public Sub Grabar()
            Dim int As Integer = -1
            Dim obj As New Farmacia.Business.Ventas.Comprobante
            ' int = obj.pagar()

            

        End Sub

        Private Sub btn_OrdenVenta_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_OrdenVenta.Click

        End Sub

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            BuscarCLiente()
        End Sub

        Public Sub BuscarCliente()
            Dim obj As New Farmacia.Business.Cliente.Cliente
            Dim entCliente As Farmacia.Entity.Cliente.Cliente

            entCliente = obj.Listar(-1, Me.txt_cli_codigo.Text)
            If entCliente Is Nothing Then
                Me.txt_cli_codigo.Text = ""
                Me.txt_cli_nombre.Text = ""
            Else
                Me.txt_cli_nombre.Text = entCliente.Nombre
                ClienteID = entCliente.ClienteId
            End If




        End Sub
    End Class
End Namespace

